package com.bb.test;

import cn.bb.pojo.Computer;
import cn.bb.pojo.TestBean;
import cn.bb.pojo.User;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

public class Demo1 {
    /*ApplicationContext app = null;
    @Before
    public void init(){
        app = new ClassPathXmlApplicationContext("spring.xml");
    }*/

    @Test
    public void test1(){
        ClassPathXmlApplicationContext app =new ClassPathXmlApplicationContext("spring.xml");
        User us = app.getBean("users", User.class);
        us.setName("张三");
        us.setAge(12);
        us.printlnijfo();
        app.close();
    }
    @Test
    public void test2(){
        ApplicationContext app =new ClassPathXmlApplicationContext("spring.xml");
        Computer co = app.getBean("computer", Computer.class);
       // co.getMainFrame().setModelType("高配");
        co.printlnComputerInfo();
    }
    @Test
    public void test3(){
        ApplicationContext app =new ClassPathXmlApplicationContext("spring.xml");
        TestBean te = app.getBean("testBean", TestBean.class);
        System.out.println(te.getList()+","+te.getMap()+","+te.getProp()+","+te.getSet());
    }
}
